package com.ym.pms.resolvers;

import com.ym.pms.utils.JSONResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Author: xybh
 * @Description:
 * @Date: Created in 14:22 2020/12/11
 * @Modified:
 */
//@RestControllerAdvice
public class GlobalExceptionResolver {
    private static final Logger log = LoggerFactory.getLogger(GlobalExceptionResolver.class);

    @ExceptionHandler
    @ResponseBody
    public JSONResult handleException(Exception e){
        log.error(e.getMessage());
        return JSONResult.errorMsg(e.getMessage());
    }
}
